package util

import "github.com/go-playground/validator/v10"

const (
	maxDescriptionLength = 255
)

func ValidateDescription(v *validator.Validate) {
	v.RegisterValidation("description", func(fl validator.FieldLevel) bool {
		description := fl.Field().String()
		return len(description) <= maxDescriptionLength
	})
}

func ValidateName(v *validator.Validate) {
	v.RegisterValidation("name", func(fl validator.FieldLevel) bool {
		name := fl.Field().String()
		return len(name) > 2
	})
}
